<?php

namespace App\Transformers;


class ProvinceTransformer extends BaseTransformer
{

    public function transform($model)
    {
        if (in_array('city', $this->field)) {
            $this->defaultIncludes  = ['city'];
        }
        return $model->toArray();
    }

    public function includeCity($province) {
        return $this->collection($province->citys, new CityTransformer(['id']), '');
    }

}
